import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Home from "../views/Home/index.vue";
import Layout from "../layout/index.vue";

const routes: RouteRecordRaw[] = [
  {
    path: "/",
    component: Layout,
    redirect: '/home',
    meta: {
    },
    children: [
      {
        path: "/home",
        component: Home,
        meta: {
          title: '首页',
        }
      },
      {
        path: "/table",
        component: () => import('@/views/table/index.vue'),
        meta: {
          title: '表格',
        }
      },
      {
        path: "/form",
        component: () => import('@/views/form/index.vue'),
        meta: {
          title: '表单',
        }
      },
      {
        path: '/chooseArea',
        name: 'ChooseArea',
        component: () => import('@/views/chooseArea/index.vue'),
        meta: {
          title: '省市区',
        }
      },
      {
        path: '/chooseTime',
        name: 'ChooseTime',
        component: () => import('@/views/chooseTime/index.vue'),
        meta: {
          title: '时间与日历',
        }
      },
      {
        path: '/upload',
        name: 'Upload',
        component: () => import('@/views/upload/index.vue'),
        meta: {
          title: '图片上传',
        }
      },
    ],
  },
];

const router = createRouter({
  routes,
  history: createWebHistory(),
});

export default router;